import { useUserStore } from "@/store/userStore";
import { App } from "vue";

export function regPermission(app: App) {
  app.directive('pm', {
    // 如果传入的 value 被 userStore.数组 包含，就显示，否则就删除
    mounted(el, binding) {
      const store = useUserStore();
      // 没有权限
      if (!store.permissions.includes(binding.value)) {
        el.remove();
      }
    }
  })
}